package org.springblade.modules.admin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.admin.enums.MaintainPlanContentEnum;

/**
 * 工单历史图片表
 */
@Data
@TableName(value = "blade_plan_history_image")
public class PlanHistoryImage extends TenantEntity {

    /**
     * 计划任务id
     */
    @TableField(value = "plan_id")
    private Long planId;

	/**
	 * 计划模板id
	 */
	@TableField(value = "template_id")
	private String templateId;

	/**
	 * 计划模板名称
	 */
	@TableField(value = "template_name")
	private String templateName;

    /**
     * 保养任务位置分类id
     */
    @TableField(value = "location_type_id")
    private String locationTypeId;

    /**
     * 保养任务位置分类名称
     */
    @TableField(value = "location_type_name")
    private String locationTypeName;

    /**
     * 图片url
     */
    @TableField(value = "url")
    private String url;

    /**
     * 模板id
     */
    @TableField(value = "template_content_id")
    private Long templateContentId;

    /**
     * 模板名称
     */
    @TableField(value = "template_content_name")
    private String templateContentName;

    /**
     * 签到id
     */
    @TableField(value = "sign_id")
    private Long signId;

    /**
     * 1-签到 2-签退 3-工作项内容
     */
    @TableField(value = "img_from")
    private Integer imgFrom;

    /**
     * AI识别结果：
	 * -1: -无法识别
	 *
	 * 0："合规"
	 *
	 * 1："存疑"(异常| 疑似合规)
	 *
	 * 2："不合规" (异常)
     */
    @TableField(value = "`result`")
    private Integer result;

	/**
	 * -1: -无法识别
	 * 0："合规"
	 * 1："存疑"(异常| 疑似合规)
	 * 2："不合规" (异常)
	 */
	@TableField(value = "business_result")
	private Integer businessResult;

	/**
	 * 识别结果申述
	 */
	@TableField(value = "`desc`")
	private String desc;

	/**
	 * 识别结果申述人ID
	 */
	@TableField(value = "appeal_user")
	private Long appealUser;

	/**
	 * 识别结果申述时间
	 */
	@TableField(value = "appeal_time")
	private Date appealTime;

    /**
     * 审核时间
     */
    @TableField(value = "audit_time")
    private Date auditTime;

	/**
	 * 水印数据
	 */
	@TableField(value = "watermark")
	private String watermark;

	/**
	 * 模型结果数据
	 */
	@TableField(value = "model_result")
	private String modelResult;

	/**
	 * 模型id
	 */
	@TableField(value = "model_id")
	private String modelId;

	/**
	 * 1-IOS 2-Android 3-小程序 4-WEB
	 */
	@TableField(value = "source")
	private Integer source;

	@TableField(exist = false)
	private Integer planTypeStatus;

	@TableField(exist = false)
	private Integer planStatus;

	@TableField(exist = false)
	private String planTypeStatusName;

	@TableField(exist = false)
	private String elevatorAddress;

	@TableField(exist = false)
	private String buildingName;

	@TableField(exist = false)
	private String updateUserName;

	/**
	 * 识别结果申诉人名称
	 */
	@TableField(exist = false)
	private String appealUserName;

	/**
	 * 评分抽检状态0:未抽检，1：已抽检
	 */
	@TableField(exist = false)
	private String scoreSpotCheckType;

	@TableField(exist = false)
	private String resultStr;

	@TableField(exist = false)
	private String businessResultStr;

	@TableField(exist = false)
	private String statusStr;

	@TableField(exist = false)
	private String imgFromStr;

	@TableField(exist = false)
	private String buildingIdStr;

	@TableField(exist = false)
	private String elevatorIdStr;

	/**
	 * 工单评分 1-参与 2-不参与
	 */
	@TableField(exist = false)
	private Integer partScore;

	@TableField(exist = false)
	private Date startTime;

	@TableField(exist = false)
	private Date endTime;

	@TableField(exist = false)
	private Date createStartTime;

	@TableField(exist = false)
	private Date createEndTime;

	/**
	 * 审核时间排序 1-倒序 2-正序
	 */
	@TableField(exist = false)
	private Integer auditTimeSort;

	/**
	 * 创建时间排序 1-倒序 2-正序
	 */
	@TableField(exist = false)
	private Integer createTimeSort;

	@TableField(exist = false)
	private Long elevatorId;

	public void setPlanTypeStatus(Integer planTypeStatus) {
		this.planTypeStatus = planTypeStatus;
		if(Func.isNotEmpty(planTypeStatus)){
			this.planTypeStatusName = MaintainPlanContentEnum.getName(planTypeStatus);
		}
	}
}
